<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	May 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/candidates/tmpl/mycv.php
 ^ 
 * Description: template view my cv
 ^ 
 * History:		NONE
 ^ 
 */
 
 defined('_JEXEC') or die('Restricted access');
   global $mainframe;
  $document =& JFactory::getDocument();

  /*$document->addScript( 'components/com_wrecruit/js/jquery-1.7.2.min.js' );
  $document->addScript( 'components/com_wrecruit/js/jquery-ui.min.js' );
  $document->addScript( 'components/com_wrecruit/js/jquery.uniform.js' );
  $document->addScript( 'components/com_wrecruit/js/scripts.js' );*/
  $document->addScript( 'components/com_wrecruit/js/popup.js' );
  $document->addStyleSheet('components/com_wrecruit/css/popup.css');
  $document->addStyleSheet('components/com_wrecruit/css/chosen/chosen.css');
  $candidate = $this->getModel('wrecruit', 'WRecruitModel');
  $user	=& JFactory::getUser();
  if(isset($user->id) && $user->id == 0 || $user->id == ''){
	   $app =& JFactory::getApplication(); 
	   $app->enqueueMessage( JText::_( 'Please <a href="index.php?option=com_users&view=login">Login</a>' ), 'Login access' );
	  return;
  }else{
  	$candidateObj = $candidate->getAllCandidatesInfor($user->id);
	if( !$candidateObj ){
		$app =& JFactory::getApplication(); 
       //add a message to the message queue
        $app->enqueueMessage( JText::_( 'Please <a href="index.php?option=com_users&view=login">Login</a>' ), 'Login access' );

		return;
	}
	
  }
  $com_base = "components/com_wrecruit/";
  //Registric resume access
  if(!$candidate->checkAuticationResume($user->id,JRequest::getVar('id'))){
	  $session = &JFactory::getSession();
	  $msg = $session->get('job_msg');
	  echo $msg;
	  return;
  }
?>


				<div class="box-list-job">
					<div class="job-seeker-panel">
						<?php include('components/com_wrecruit/views/candidates/tmpl/menuLeft.php');?>
					</div>
					
					<div class="job-seeker-right">
						<div class="head-title">
						<h2>My CV</h2>
						</div>
						<?php
						$styles = "
							.cv_title_label{
								color:#000;
								font-weight:bold;
							}
						";
						$document->addStyleDeclaration($styles, 'text/css');
						if ($data = $candidate->getCvViewInfoById(JRequest::getVar('id')) ) {
						      if($data->RESUME_TYPE!=1){ 
									echo "Does not valide cv type!";
						       }else{	
						?>
                                    <div class="divwrapp-mycv">
										<?php
											if($data->FILENAME !=''){
											   if(JRequest::getVar('action') || JRequest::getVar('action') == 'download'){
												  //$document->setRedirect(JRoute::_(JURI::base()), $msg);
												  //echo "dsdsddf df dsf sdf";
												 $linkdownload = JURI::base()."wrecruitdata/data/jobseeker/resume_".JRequest::getVar('id')."/resume/".$data->FILENAME;
												 header('LOCATION:'.$linkdownload);
											   }
											  $dlind = JURI::base()."index.php?option=com_wrecruit&c=wrecruit&view=candidates&layout=".JRequest::getVar('layout')."&Itemid=".JRequest::getVar('Itemid')."&id=".JRequest::getVar('id')."&action=download";
											  ?>
												<a href="<?php echo $dlind;?>" title="<?php echo $data->APPLICATION_TITLE;?>"/>Download</a>
											  <?
											}elseif($data->FILECONTENT != ''){
												echo $data->FILECONTENT;
											}
										?>
								     
                                    </div>
									<!--//Ennd Background-->
									 
					  <?php
						}//end Check type
					  } 
					  ?>			 
                 
					</div>
					
				</div>
				
				<div class="box-banner-bottom">					
					<img src="<?php echo $com_base;?>images/banner-avertise-bottom.jpg" alt="" title="" width="745" height="122" />
				</div>
	  <!--popup content-->
        <div id="popupContainer" class="hidden" style="text-align:left;">
            <a id="close" class="hidden" title="close popup"></a>   
            <center>
            <form action="index.php" method="post">
            <table border="0">
            	<tr>
                	<td><input type="text" class="text" value="<?php echo $candidateObj->EMAIL;?>" name="mails" /></td>
                    <td></td>
                </tr>
                <tr>
                	<td colspan="2" align="right"> <input type="submit" value="Save" /></td>
                </tr>
            </table>
            </form>
            </center>
             
        </div>
        <div id="overlayEffect">
        </div>
       <!--end popup content--> 
